package com.piggy.logi.sys.api;

import com.piggy.common.core.constant.SecurityConstants;
import com.piggy.logi.sys.api.factory.RemoteLogiLogFallbackFactory;
import com.piggy.logi.sys.api.domain.LogiSysLogininfor;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import com.piggy.common.core.constant.ServiceNameConstants;
import com.piggy.common.core.domain.R;
import com.piggy.logi.sys.api.domain.LogiSysOperLog;

/**
 * 日志服务
 *
 * @author shark
 */
@FeignClient(contextId = "remoteLogiLogService", value = ServiceNameConstants.SYSTEM_LOGI_SERVICE, fallbackFactory = RemoteLogiLogFallbackFactory.class)
public interface RemoteLogiLogService {
    /**
     * 保存系统日志
     *
     * @param logiSysOperLog 日志实体
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping("/logi/operlog")
    public R<Boolean> saveLog(@RequestBody LogiSysOperLog logiSysOperLog, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 保存访问记录
     *
     * @param logiSysLogininfor 访问实体
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping("/logi/logininfor")
    public R<Boolean> saveLogininfor(@RequestBody LogiSysLogininfor logiSysLogininfor, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
